<?php
namespace Admin\Model;
class RuleModel extends AdminBaseModel
{
    protected $tableName = 'admin_rule';

    public function privilege()
    {


    }

    /**获取可以勾选的权限
     * @return mixed
     */
    public  function getAllRule()
    {
        return $this->field('id,title,url,uuid')->where('status = 1 and allow_all = 0')->select();
    }

    /**获取角色拥有的权限id
     * @param $roleId
     * @return mixed
     */
    public  function getOwnRule($roleId)
    {
        return M('admin_role_rule')->where('role_id = '.$roleId)->getField('rule_id',true);
    }

}